import request from "@/utils/request";

// 查询运费模板列表
export function listTemplate(query) {
  return request({
    url: "/logisticsTemplate/list",
    method: "post",
    params: query,
  });
}

// 模板名称判重
export function existByName(templateName) {
  return request({
    url: "/logisticsTemplate/getCountByName/" + templateName,
    method: "get",
  });
}


//获取详情
export function getTemplate(id) {
  return request({
    url: "/logisticsTemplate/" + id,
    method: "get",
  });
}




//新增提交
export function addTemplate(data) {
  return request({
    url: "/logisticsTemplate/add",
    method: "post",
    data: data,
  });
}

//修改保存
export function updateTemplate(data) {
  return request({
    url: "/logisticsTemplate",
    method: "put",
    data: data,
  });
}

//真删除
export function delTemplate(id) {
  return request({
    url: "/logisticsTemplate/del/" + id,
    method: "get",
  });
}

//逻辑删除
export function logicalDel(id) {
  return request({
    url:  `/logisticsTemplate/logicalDeletionById/${id}`,
    method: "get",
  });
}


//根据运送方式获取快递公司
export function getCompanyList(method) {
  return request({
    url: "/logisticsTemplate/getCompanyList/" + method,
    method: "get",
  });
}


//是否被用户档案绑定
export function isUsedByUser(id) {
  return request({
    url:  `/logisticsTemplate/isUsed/${id}`,
    method: "get",
  });
}
